package com.example.plugin;

import android.content.res.AssetManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import androidx.fragment.app.FragmentActivity;

/**
 * @author zy
 * @version V1.0
 * @description: TODO
 * @date 2020/10/19 15:24
 */
public class ImageActivity extends FragmentActivity {
    private final String TAG = "debuga";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.e(TAG, "getResource = " + getResources());
        Log.e(TAG, "getApplication class = " + getApplication().getClass().getName());
        setContentView(R.layout.activity_image);
    }

    //使用资源文件的时候下面的内容必须加上,可以在父类中添加

    @Override
    public Resources getResources() {
        if (getApplication() != null && getApplication().getResources() != null) {
            return getApplication().getResources();
        }
        return super.getResources();
    }

    @Override
    public AssetManager getAssets() {
        if (getApplication() != null && getApplication().getAssets() != null) {
            return getApplication().getAssets();
        }
        return super.getAssets();
    }

    @Override
    public Resources.Theme getTheme() {
        if (getApplication() != null && getApplication().getTheme() != null) {
            return getApplication().getTheme();
        }
        return super.getTheme();
    }
}
